-----------------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  C:\Users\arthu\Dropbox\research\mte_at\codes\replication\results\kh_2009pa_clean.log
  log type:  text
 opened on:   8 Jun 2023, 18:27:52

. 
. * global command
. global data "C:\Users\arthu\Dropbox\research\mte_at\codes\replication\data"

. 
. *******************************************************************************
. * prepare: data cleaning, gen var, and gen data
. *******************************************************************************
. 
. * read data
. use "$data\za6008.dta", clear

. 
. ***********************
. * check var: instrument
. ***********************
. 
. tab u88_0600

untersuchungsbe |
       zirke ** |      Freq.     Percent        Cum.
----------------+-----------------------------------
       schwerin |        192        5.39        5.39
      magdeburg |        549       15.41       20.80
         berlin |        419       11.76       32.56
        cottbus |         60        1.68       34.24
        leipzig |        277        7.77       42.02
        dresden |        784       22.00       64.02
karl-marx-stadt |        633       17.77       81.79
         erfurt |        649       18.21      100.00
----------------+-----------------------------------
          Total |      3,563      100.00

. label var u88_0600 "investigation areas"

. // 1 = schwerin, 2 = magdeburg, 3 = berlin, 4 = cottbus, 5 = leipzig
. // 6 = dresden, 7 = karl-marx-stadt, 8 = erfurt
. 
. **********************
. * check var: treatment
. **********************
. 
. tab u88_0079

     medienempfang - |
   fernsehen der brd |      Freq.     Percent        Cum.
---------------------+-----------------------------------
             t0glich |      1,862       53.51       53.51
mehrmals w0chentlich |        801       23.02       76.52
  einmal w0chentlich |         64        1.84       78.36
            seltener |        209        6.01       84.37
     0berhaupt nicht |        544       15.63      100.00
---------------------+-----------------------------------
               Total |      3,480      100.00

. label var u88_0079 "media reception - television of the brd"

. // 1 = toglich = daily, 2 = mehrmals wöchentlich = several times a week
. // 3 = einmal wöchentlich = once a week, 4 = seltener = less common
. // 5 = 0berhaupt nicht = not at all
. 
. ********************
. * check var: outcome
. ********************
. 
. tab u88_0037

            bin von |
marxist.weltanschau |
      ung 0berzeugt |      Freq.     Percent        Cum.
--------------------+-----------------------------------
         vollkommen |        571       16.24       16.24
mit einschr0nkungen |      1,697       48.25       64.49
               kaum |        850       24.17       88.66
    0berhaupt nicht |        399       11.34      100.00
--------------------+-----------------------------------
              Total |      3,517      100.00

. label var u88_0037 "convinced of Leninist/Marxist worldview"

. // 1 = vollkommen = perfectly, 2 = mit einschränkungen = with restrictions
. // 3 = kaum = barely, 4 = 0berhaupt nicht = not at all
. 
. tab u88_0039

 ich f0hle mich mit |
        der ddr eng |
          verbunden |      Freq.     Percent        Cum.
--------------------+-----------------------------------
         vollkommen |        809       22.94       22.94
mit einschr0nkungen |      1,963       55.67       78.62
               kaum |        600       17.02       95.63
    0berhaupt nicht |        154        4.37      100.00
--------------------+-----------------------------------
              Total |      3,526      100.00

. label var u88_0039 "feel closely attached to East Germany"

. // coding rule is the same with u88_0037
. 
. tab u88_0040

   machtaus0bung in |
  der ddr in meinem |
              sinne |      Freq.     Percent        Cum.
--------------------+-----------------------------------
         vollkommen |        373       10.61       10.61
mit einschr0nkungen |      1,969       55.99       66.59
               kaum |        874       24.85       91.44
    0berhaupt nicht |        301        8.56      100.00
--------------------+-----------------------------------
              Total |      3,517      100.00

. label var u88_0040 "poli power is exercised in ways consistent with my views"

. // coding rule is the same with u88_0037
. 
. *********************************************
. * check var: limited set of control variables
. *********************************************
. 
. tab u88_0085

      alter |      Freq.     Percent        Cum.
------------+-----------------------------------
         15 |          7        0.20        0.20
         16 |        190        5.43        5.63
         17 |        453       12.95       18.59
         18 |        426       12.18       30.77
         19 |        248        7.09       37.86
         20 |        231        6.61       44.47
         21 |        193        5.52       49.99
         22 |        211        6.03       56.02
         23 |        192        5.49       61.51
         24 |        200        5.72       67.23
         25 |        162        4.63       71.86
         26 |        128        3.66       75.52
         27 |        121        3.46       78.98
         28 |        128        3.66       82.64
         29 |         99        2.83       85.47
         30 |         82        2.34       87.82
         31 |         51        1.46       89.28
         32 |         48        1.37       90.65
         33 |         48        1.37       92.02
         34 |         41        1.17       93.19
         35 |         26        0.74       93.94
         36 |         50        1.43       95.37
         37 |         33        0.94       96.31
         38 |         30        0.86       97.17
         39 |         14        0.40       97.57
         40 |         12        0.34       97.91
         41 |         15        0.43       98.34
         42 |          7        0.20       98.54
         43 |          6        0.17       98.71
         44 |          9        0.26       98.97
         45 |         13        0.37       99.34
         46 |          4        0.11       99.46
         47 |          2        0.06       99.51
         48 |         11        0.31       99.83
         49 |          3        0.09       99.91
         50 |          3        0.09      100.00
------------+-----------------------------------
      Total |      3,497      100.00

. label var u88_0085 "age"

. gen age = u88_0085
(67 missing values generated)

. label var age "age"

. 
. gen age_bin_5 = .
(3,564 missing values generated)

. label var age_bin_5 "age cohort: 5 years"

. replace age_bin_5 = 1 if age < 21
(1,555 real changes made)

. replace age_bin_5 = 2 if age > 20 & age < 26
(958 real changes made)

. replace age_bin_5 = 3 if age > 25 & age < 31
(558 real changes made)

. replace age_bin_5 = 4 if age > 30 & age < 36
(214 real changes made)

. replace age_bin_5 = 5 if age > 35 & age < 41
(139 real changes made)

. replace age_bin_5 = 6 if age > 40 & age < 51
(73 real changes made)

. tab age_bin_5

age cohort: |
    5 years |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |      1,555       44.47       44.47
          2 |        958       27.39       71.86
          3 |        558       15.96       87.82
          4 |        214        6.12       93.94
          5 |        139        3.97       97.91
          6 |         73        2.09      100.00
------------+-----------------------------------
      Total |      3,497      100.00

. 
. gen age_bin_10 = .
(3,564 missing values generated)

. label var age_bin_10 "age cohort: 10 years"

. replace age_bin_10 = 1 if age < 21
(1,555 real changes made)

. replace age_bin_10 = 2 if age > 20 & age < 31
(1,516 real changes made)

. replace age_bin_10 = 3 if age > 30 & age < 41
(353 real changes made)

. replace age_bin_10 = 4 if age > 40 & age < 51
(73 real changes made)

. 
. tab u88_0086

 geschlecht |      Freq.     Percent        Cum.
------------+-----------------------------------
   m0nnlich |      1,846       52.35       52.35
   weiblich |      1,680       47.65      100.00
------------+-----------------------------------
      Total |      3,526      100.00

. label var u88_0086 "gender"

. // 1 = männlich = male; 2 = weiblich = female
. gen gender = u88_0086
(38 missing values generated)

. // 1 = male, 2 = female
. label var gender "gender"

. 
. tab u88_0095

          berufliche |
 qualifikation vater |      Freq.     Percent        Cum.
---------------------+-----------------------------------
 ohne berufsabschlu0 |         60        1.85        1.85
    teilfacharbeiter |         49        1.51        3.35
facharbeiterabschlu0 |      1,686       51.86       55.21
     meisterabschlu0 |        572       17.59       72.81
   fachschulabschlu0 |        441       13.57       86.37
hochschul/uniabschl. |        443       13.63      100.00
---------------------+-----------------------------------
               Total |      3,251      100.00

. label var u88_0095 "occupational classification for father"

. gen father_occ = u88_0095
(313 missing values generated)

. // 1 = ohne berufsabschluss = no professional qualification,
. // 2 = teilfacharbeiter = partial skilled worker,
. // 3 = facharbeiterabschluss = skilled worker qualification,
. // 4 = meister abschlu0 = master degree,
. // 5 = fachschule abschlu0 = technical school graduation,
. // 6 = hochschul/uniabschl = university/university graduate
. label var father_occ "occupational classification for father"

. 
. tab u88_0096

          berufliche |
qualifikation mutter |      Freq.     Percent        Cum.
---------------------+-----------------------------------
 ohne berufsabschlu0 |        255        7.61        7.61
    teilfacharbeiter |         90        2.69       10.30
facharbeiterabschlu0 |      2,228       66.51       76.81
     meisterabschlu0 |        164        4.90       81.70
   fachschulabschlu0 |        430       12.84       94.54
hochschul/uniabschl. |        183        5.46      100.00
---------------------+-----------------------------------
               Total |      3,350      100.00

. label var u88_0096 "occupational classification for mother"

. gen mother_occ = u88_0096 // coding rule is the same with father
(214 missing values generated)

. label var mother_occ "occupational classification for mother"

. 
. ******************************************
. * check var: full set of control variables
. ******************************************
. 
. tab u88_0089

familiensta |
         nd |      Freq.     Percent        Cum.
------------+-----------------------------------
      ledig |      2,389       67.77       67.77
verheiratet |        999       28.34       96.11
 geschieden |        125        3.55       99.66
  verwitwet |         12        0.34      100.00
------------+-----------------------------------
      Total |      3,525      100.00

. // 1 = ledig = single, 2 = verheiratet = married
. // 3 = geschieden = divorced, 4 = verwitwet = widowed
. label var u88_0089 "marital status"

. gen marital = u88_0089 // 1 = single, 2 = married, 3 = divorced, 4 = widowed
(39 missing values generated)

. label var marital "marital status"

. 
. tab u88_0091

     zahl der kinder |      Freq.     Percent        Cum.
---------------------+-----------------------------------
               keine |      2,357       67.21       67.21
            ein kind |        649       18.51       85.71
         zwei kinder |        416       11.86       97.58
         drei kinder |         66        1.88       99.46
mehr als drei kinder |         19        0.54      100.00
---------------------+-----------------------------------
               Total |      3,507      100.00

. // 1 = keine = no, 2 = ein kind = a child
. // 3 = zwei kinder = two children, 4 = drei kinder = three children
. // 5 = mehr als drei kinder = more than three children
. label var u88_0091 "number of children"

. gen numb_child = u88_0091 // 0 = 0, 1 = 1, 2 = 2, 3 = 3, 4 = more than 3
(57 missing values generated)

. label var numb_child "number of children"

. 
. tab u88_0092

     schulabschlu0 |      Freq.     Percent        Cum.
-------------------+-----------------------------------
 bis 8. klasse pos |        116        3.29        3.29
     8. klasse pos |        211        5.98        9.26
    10. klasse pos |      2,838       80.37       89.63
12. klasse eos/abi |        366       10.37      100.00
-------------------+-----------------------------------
             Total |      3,531      100.00

. // 1 = bis 8. klasse pos = up to 8th grade pos,
. // 2 = 8. klasse pos = 8th grade pos
. // 3 = 10. klasse pos = 10th class pos,
. // 4 = 12. klasse eos_abi = 12th grade eos_abi
. label var u88_0092 "education"

. gen educ = u88_0092
(33 missing values generated)

. // 1 = less than high school, 2 = some high school
. // 3 = standard school, 4 = special advanced school
. label var educ "education"

. 
. tab u88_0093

          berufliche |
       qualifikation |
             aktuell |      Freq.     Percent        Cum.
---------------------+-----------------------------------
        noch sch0ler |          5        0.14        0.14
       noch lehrling |        908       26.10       26.24
        noch student |         21        0.60       26.85
 ohne berufsabschlu0 |         42        1.21       28.05
    teilfacharbeiter |         51        1.47       29.52
facharbeiterabschlu0 |      1,815       52.17       81.69
     meisterabschlu0 |         73        2.10       83.79
   fachschulabschlu0 |        365       10.49       94.28
hochschul/uniabschl. |        199        5.72      100.00
---------------------+-----------------------------------
               Total |      3,479      100.00

. // 1 = noch sch0ler = still students, 2 = noch lehrling = still apprentice
. // 3 = noch student = still a student,
. // 4 = ohne berufsabschluss = without a professional qualification
. // 5 = teilfacharbeiter = partial skilled worker
. // 6 = facharbeiterabschluss = skilled worker qualification
. // 7 = meister abschlu0 = master degree
. // 8 = fachschule abschlu0 = technical school graduation
. // 9 = hochschul/uni abschl. = university degree
. label var u88_0093 "professional qualification"

. gen prof_quali = u88_0093
(85 missing values generated)

. // 1 = still in school, 2 = stll an apprentice
. // 3 = still at university, 4 = without qualification, 5 = some skill
. // 6 = certified with skill, 7 = master certified,
. // 8 = professional school, 9 = university graduate
. label var prof_quali "professional qualification"

. 
. tab u88_0102

monatliches |
nettoeinkom |
        men |      Freq.     Percent        Cum.
------------+-----------------------------------
bis   500 m |        357       13.02       13.02
bis   600 m |        330       12.04       25.05
bis   700 m |        455       16.59       41.65
bis   800 m |        562       20.50       62.14
bis   900 m |        472       17.21       79.36
bis  1000 m |        310       11.31       90.66
bis  1200 m |        192        7.00       97.67
bis  1500 m |         52        1.90       99.56
0ber 1500 m |         12        0.44      100.00
------------+-----------------------------------
      Total |      2,742      100.00

. label var u88_0102 "income"

. gen inc = u88_0102
(822 missing values generated)

. label var inc "income"

. 
. tab u88_0101

     berufst0tigkeit |      Freq.     Percent        Cum.
---------------------+-----------------------------------
ja,vollzeitbesch0ft. |      2,564       72.59       72.59
ja,teilzeitbesch0ft. |        145        4.11       76.70
nein, zur zeit nicht |         10        0.28       76.98
nein,noch ausbildung |        813       23.02      100.00
---------------------+-----------------------------------
               Total |      3,532      100.00

. // 1 = ja,vollzeitbesch0ft. = yes, full-time
. // 2 = ja,teilzeitbesch0ft. = yes, part-time
. // 3 = nein, zur zeit nicht = no, not at this time
. // 4 = nein,noch ausbildung = no, still training
. label var u88_0101 "employment status"

. gen employ = u88_0101
(32 missing values generated)

. // 1 = full time, 2 = part time, 3 = not right now
. // 4 = still training
. label var employ "employment status"

. 
. ********************
. * generate variables
. ********************
. 
. * gen: instrument (ignore missing values)
. gen not_dresden = 0 if u88_0600 == 6 // if live in dresden, not_dresden = 0
(2,780 missing values generated)

. replace not_dresden = 1 if u88_0600 != 6 & u88_0600 != . // if not live in dresden, not_dresden = 1
(2,779 real changes made)

. label var not_dresden "not live in Dresden district"

. 
. * gen: treatment (ignore missing values)
. gen wg_tv = 0 if u88_0079 == 5 // u88_0079 == 5 means ``0berhaupt nicht/not at all''
(3,020 missing values generated)

. replace wg_tv = 1 if u88_0079 != 5 & u88_0079 != .
(2,936 real changes made)

. label var wg_tv "watch West German TV"

. 
. * gen: outcome (recode to match with Table 2, and ignore missing values)
. foreach var of varlist u88_0037 u88_0039 u88_0040{
  2. 
.   gen `var'_kh = 1 if `var' == 4
  3.   replace `var'_kh = 2 if `var' == 3
  4.   replace `var'_kh = 3 if `var' == 2
  5.   replace `var'_kh = 4 if `var' == 1
  6.   
. }
(3,165 missing values generated)
(850 real changes made)
(1,697 real changes made)
(571 real changes made)
(3,410 missing values generated)
(600 real changes made)
(1,963 real changes made)
(809 real changes made)
(3,263 missing values generated)
(874 real changes made)
(1,969 real changes made)
(373 real changes made)

. gen lenin_kh = u88_0037_kh
(47 missing values generated)

. label var lenin_kh "convinced of Leninist/Marxist worldview"

. gen east_ger_kh = u88_0039_kh
(38 missing values generated)

. label var east_ger_kh "feel closely attached to East Germany"

. gen poli_pow_kh = u88_0040_kh
(47 missing values generated)

. label var poli_pow_kh "political power is exercised in ways consistent with my views"

. 
. * gen: binary outcome (ignore missing values)
. foreach var of varlist u88_0037 u88_0039 u88_0040{
  2. 
.   gen `var'_b = 0 if `var' == 3 | `var' == 4
  3.   replace `var'_b = 1 if `var' == 1 | `var' == 2
  4.   
. }
(2,315 missing values generated)
(2,268 real changes made)
(2,810 missing values generated)
(2,772 real changes made)
(2,389 missing values generated)
(2,342 real changes made)

. gen lenin_b = u88_0037_b
(47 missing values generated)

. label var lenin_b "convinced of Leninist/Marxist worldview"

. gen east_ger_b = u88_0039_b
(38 missing values generated)

. label var east_ger_b "feel closely attached to East Germany"

. gen poli_pow_b = u88_0040_b
(47 missing values generated)

. label var poli_pow_b "political power is exercised in ways consistent with my views"

. 
. * sum: viewership by iv (replicate table 1)
. forvalues i = 0(1)1{
  2. 
.   tab u88_0079 if not_dresden == `i'
  3. 
. }

   media reception - |
   television of the |
                 brd |      Freq.     Percent        Cum.
---------------------+-----------------------------------
             t0glich |         42        5.72        5.72
mehrmals w0chentlich |         69        9.40       15.12
  einmal w0chentlich |         17        2.32       17.44
            seltener |        108       14.71       32.15
     0berhaupt nicht |        498       67.85      100.00
---------------------+-----------------------------------
               Total |        734      100.00

   media reception - |
   television of the |
                 brd |      Freq.     Percent        Cum.
---------------------+-----------------------------------
             t0glich |      1,820       66.28       66.28
mehrmals w0chentlich |        732       26.66       92.94
  einmal w0chentlich |         47        1.71       94.65
            seltener |        101        3.68       98.32
     0berhaupt nicht |         46        1.68      100.00
---------------------+-----------------------------------
               Total |      2,746      100.00

. 
. * sum: political attitudes (replicate table 2)
. foreach var of varlist lenin_kh east_ger_kh poli_pow_kh{
  2. 
.   tab `var'
  3.   
. }

  convinced |
         of |
Leninist/Ma |
      rxist |
  worldview |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |        399       11.34       11.34
          2 |        850       24.17       35.51
          3 |      1,697       48.25       83.76
          4 |        571       16.24      100.00
------------+-----------------------------------
      Total |      3,517      100.00

       feel |
    closely |
attached to |
       East |
    Germany |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |        154        4.37        4.37
          2 |        600       17.02       21.38
          3 |      1,963       55.67       77.06
          4 |        809       22.94      100.00
------------+-----------------------------------
      Total |      3,526      100.00

  political |
   power is |
  exercised |
    in ways |
 consistent |
    with my |
      views |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |        301        8.56        8.56
          2 |        874       24.85       33.41
          3 |      1,969       55.99       89.39
          4 |        373       10.61      100.00
------------+-----------------------------------
      Total |      3,517      100.00

. 
. * drop missing values
. drop if u88_0037 == . | u88_0039 == . | u88_0040 == . | not_dresden == . | wg_tv == .
(136 observations deleted)

. 
. ***********************************
. * gen data: generate data set for R
. ***********************************
. 
. * keep useful variables
. keep lenin_b east_ger_b poli_pow_b not_dresden wg_tv age gender father_occ ///
>   mother_occ age_bin_5 age_bin_10 lenin_kh east_ger_kh poli_pow_kh

.   
. * drop observations with missing values on y, t, z, and covariates
. drop if lenin_b == . | east_ger_b == . | poli_pow_b == . | not_dresden == . | ///
>   wg_tv == . | age == . | gender == . | father_occ == . | mother_occ == .
(405 observations deleted)

. 
. * rename variables
. rename lenin_b lenin

. rename east_ger_b east_ger

. rename poli_pow_b poli_pow

. 
. rename wg_tv treatment

. rename not_dresden iv

. 
. * save data
. save "$data\kh_2009pa_cleaned.dta", replace
file C:\Users\arthu\Dropbox\research\mte_at\codes\replication\data\kh_2009pa_cleaned.dta saved

. 
. * close log file
. log close
      name:  <unnamed>
       log:  C:\Users\arthu\Dropbox\research\mte_at\codes\replication\results\kh_2009pa_clean.log
  log type:  text
 closed on:   8 Jun 2023, 18:27:53
-----------------------------------------------------------------------------------------------------
